package com.hsh.web;

import com.hsh.bean.Blog;
import com.hsh.service.OneBlogService;
import com.hsh.service.impl.OneBlogServiceImpl;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(value = "/favorServlet")
public class FavorServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        OneBlogService oneBlogService = new OneBlogServiceImpl();
        int bid = Integer.parseInt(req.getParameter("bid"));
        Blog blog = oneBlogService.getOneBlogById(bid);
        req.setAttribute("blog",blog);
        req.getRequestDispatcher("/favorLike.jsp").forward(req,resp);
    }
}
